<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
request.setAttribute("basePath",basePath);

String fbh = request.getParameter("fbh");
String fdrillStyle = request.getParameter("fdrillStyle");
String fyear = request.getParameter("fyear");
String fbdate = request.getParameter("fbdate");
String fedate = request.getParameter("fedate");
String ftjlx = request.getParameter("ftjlx");
String foffi_type = request.getParameter("foffi_type");
String foffi_name = request.getParameter("foffi_name");
String fvalue = request.getParameter("fvalue");

System.out.println(fbh+"-"+fdrillStyle+"-"+fyear+"-"+fbdate+"-"+fedate+"-"+ftjlx+"-"+foffi_type+"-"+foffi_name+"-"+fvalue+"-");
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>首页</title>
    <link rel="stylesheet" type="text/css"
	href="<%=path%>/css/btn_class.css" />
<link rel="stylesheet" type="text/css"
	href="<%=path%>/extjs/resources/css/ext-all.css" />
<link rel="stylesheet" type="text/css" href="<%=path%>/extjs/style.css" />
<script type="text/javascript"
	src="<%=path%>/extjs/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="<%=path%>/extjs/ext-all.js"></script>

	<script type="text/javascript" src = "${basePath}/FusionCharts/FusionCharts.js"></script>
	<script type="text/javascript" src = "${basepath}/FusionCharts/FusionChartsExportComponent.js"></script>
	<script type="text/javascript" src = "${basePath}/mould_published/public.js"></script>
	
	<script type="text/javascript">
	Ext.BLANK_IMAGE_URL = "<%=path%>/extjs/resources/images/default/s.gif";
	
	/*****************************************************************************************************************
	*  统计分析部分       show_chart() 是生成方法； 每一个Ajax调用生成一个图标或报表
	*      钻取依据  -- 日期 1；年度2；季度3；月度4；天5；科室8；       
	*
	******************************************************************************************************************/
	//生成图表方法
	function show_chart() {
		var fbh = "<%=fbh%>";
		var fdrillStyle = "<%=fdrillStyle%>";
		var fvalue = "<%=fvalue%>";
		var fbdate = "<%=fbdate%>";
		var fedate = "<%=fedate%>";
		var ftjlx = "<%=ftjlx%>";
		var foffi_type = "<%=foffi_type%>";
		var foffi_name = "<%=foffi_name%>";
		var fyear = "<%=fyear%>";
		
		var fquery_str = "";
		var ftitle = "";
	
		fquery_str = getDateStr(fyear, "" + fvalue) + "##"
        + "ftjlx::mm##"
        + "foffi_type::" + foffi_type + "##"
        + "foffi_name::" + foffi_name;
		ftitle = fyear + "年" + fvalue + "月";
		
		
		var fdateTemp = "";
		if(fdrillStyle == "1" || fdrillStyle == "2" || fdrillStyle == "3" || fdrillStyle == "4" ||fdrillStyle == "5") {
			fquery_str = getDateStr(fyear, "" + fvalue) + "##"
	        + "ftjlx::mm##"
	        + "foffi_type::" + foffi_type + "##"
	        + "foffi_name::" + foffi_name;
			ftitle = fyear + "年" + fvalue + "月";
		} else {
			
			
		}
		
		
		 /**********************************************  开始展示图表     **************************************************/
		 Ext.Ajax.request({     
			 url : 'chartInfo!produceChartDataCommon.do',     
			 method : 'POST',     
			 params : {        
				 'fbh' : fbh,        
				 'fquery_str' : fquery_str,        
				 'ftitle' : ftitle,        
				 'ftype_date' : '1'     
				 },     
			 success : function(response, action) {        
				 var myChart;        
				 var data_str = new Array();        
				 var responseText = response.responseText; 
				 
				 data_str = responseText.split('$$');        
				 var chart_data = data_str[0]; 
				 var chart_style = data_str[2];
				 
				 if(chart_style == null || chart_style == "null" || chart_style == "1") {
					 myChart = new FusionCharts("${basePath}/FusionCharts/Column2D.swf","chartid121","800","350","0","1");   
				 } else if(chart_style == "2") {
					 myChart = new FusionCharts("${basePath}/FusionCharts/AngularGauge.swf","chartid121","240","240","0","1");   
				 } else if(chart_style == "3") {
					 myChart = new FusionCharts("${basePath}/FusionCharts/Line.swf","chartid121","800","350","0","1");   
				 } else if(chart_style == "4") {
					 myChart = new FusionCharts("${basePath}/FusionCharts/HLinearGauge.swf","chartid121","600","90","0","1");   
				 } else if(chart_style == "5") {
					 myChart = new FusionCharts("${basePath}/FusionCharts/Pie2D.swf","chartid121","600","350","0","1");   		 
				 } else if(chart_style == "6") {
					 myChart = new FusionCharts("${basePath}/FusionCharts/Column2D.swf","chartid121","800","350","0","1");   
                 } else if(chart_style == "7") {
                	 myChart = new FusionCharts("${basePath}/FusionCharts/Column2D.swf","chartid121","800","350","0","1");   
				 } else if(chart_style == "8") {
					 myChart = new FusionCharts("${basePath}/FusionCharts/Column2D.swf","chartid121","800","350","0","1");   
				 } else if(chart_style == "9") {
					 myChart = new FusionCharts("${basePath}/FusionCharts/Column2D.swf","chartid121","800","350","0","1");   
				 } else if(chart_style == "10") {
					 myChart = new FusionCharts("${basePath}/FusionCharts/Column2D.swf","chartid121","800","350","0","1");   		 
				 } else if(chart_style == "11") {
					 myChart = new FusionCharts("${basePath}/FusionCharts/Column2D.swf","chartid121","800","350","0","1");   
				 } else {
					 myChart = new FusionCharts("${basePath}/FusionCharts/Column2D.swf","chartid121","800","350","0","1");   
				 }
				      
				 myChart.setDataXML(chart_data); 
				 myChart.render('chart101');     
			  },     
			 failure : function() {        
				 Ext.Msg.alert('错误', '服务器出现错误请稍后再试！');     
			 }  
		  });  
		 
	}	
	
	
	/******************************************************************************************
	**                               以下是构成面板部分  包括按钮
	******************************************************************************************/
	Ext.onReady(function() {
		
		//统计分析panel
	  	var tjfx_panel = new Ext.Panel({
	    	//region: "center",
			//layout:'fit',
			border : false,
		    //title:'&nbsp;&nbsp;&nbsp;图表示例',
		    //collapsible : true,
		    autoScroll : true,
			margins:'0 5 0 0',
			
		 	html : '<div width="100%" height="100%"><table align="crnter" width="100%" height="100%">'
		 		+ '<tr><td colspan="5" height="35"></td></tr>'
					+'<tr valign="top"><td align="center" id="chart101"></td><td width="10"></td><td align="center" id="chart102"></td></td></tr>'
					+ '<tr><td colspan="5" height="15"></td></tr>'
				+ '</table></div>'
		});
		
		
	  	var index_panel = new Ext.Panel({
			region : 'center',
			resizeTabs : true,
			id : 'index_panel_id',
			frame: false,
			border: false,
			baseCls:'x-plain',
			layout: 'fit',
			cls: 'topCls',
			layoutConfig : {
				padding: 0
			},
			defaults:{
				margins:'3 0 0 0'
			},
			items  : [tjfx_panel]
		});
	  	
	  	//初始化面板
	  	var viewport = new Ext.Viewport({
            layout:'border',
            items:[index_panel]
	  	});
	  	//调用生成图表方法,要在viewport之后才行,不然获取不到id,不显示内容
	  	show_chart();
	  	
	});
	</script>
  </head>
  <body>
  	 
     
  </body>
</html>
